public class SingleTon1 {
    private SingleTon1 instance = new SingleTon1();
    private SingleTon1(){ }
    public SingleTon1 getInstance (){
        return instance;
    }
}
class SingleTon2{
    private SingleTon2 instance = null;
    private SingleTon2(){};
    public SingleTon2 getInstance(){
        if(instance==null){
            instance = new SingleTon2();
        }
        return instance;
    }
}
class SingleTon3{
    private volatile SingleTon3 instance = null;
    private SingleTon3(){}
    public  SingleTon3 getInstance(){
        if(instance==null){
            synchronized (SingleTon3.class){
                if(instance==null){
                    instance = new SingleTon3();
                }
            }
        }
        return instance;
    }
}
